﻿using B.S.BaseData.ErrorCode;
using B.S.BaseData.Manage.Api.With.Apliaction.Command.ReportlossesModelCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.BaseData.Manage.Api.With.Controllers
{
    /// <summary>
    /// 报损管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReportlossesController : ControllerBase
    {
        private readonly IMediator mediator;

        public ReportlossesController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 报损新增
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>取消</returns>
        [HttpPost]
        public async Task<ApiReqult<object>> ReportlossesAdd(ReportlossesAddModelCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改报损
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>取消</returns>
        [HttpPost]
        public async Task<ApiReqult<object>> ReportlossesUpdate(ReportlossesUpdateModelCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 删除报损
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns>取消</returns>
        [HttpPost]
        public async Task<ApiReqult<object>> ReportlossesDelete([FromQuery]ReportlossesDeleteModelCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
